-
-
Notifications
You must be signed in to change notification settings - Fork 94
Fix AddCompositionEventHandler DI registration with factory functions #462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ction Co-authored-by: alexeyzimarev <2821205+alexeyzimarev@users.noreply.github.com>
Test Results 51 files + 34 51 suites +34 29m 54s ⏱️ + 19m 41s Results for commit 6295dc5. ± Comparison against base commit a5bb50c. This pull request removes 5 and adds 17 tests. Note that renamed tests count towards both. |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||||
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
User description
The
AddCompositionEventHandlermethod was registering the factory function itself in the DI container instead of invoking it, causingGetRequiredKeyedService<THandler>to fail when resolving handlers created withAddEventHandlerWithRetries.Changes
SubscriptionBuilder.cs: Wrap factory function in lambda to invoke it during service resolution
CompositionHandlerTests.cs: Add test coverage for factory-based handler registration
The fix aligns with the existing pattern in
AddEventHandler(line 48) and enables the following usage:Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
PR Type
Bug fix, Enhancement
Description
Fix
AddCompositionEventHandlerto properly invoke handler factory functions during DI resolutionAdd comprehensive test coverage for factory-based handler registration with composition handlers
Refactor code formatting and modernize syntax across multiple files
ServiceBusMessageBuilderServiceBusHelperusingorpatternsIsSerialisableByServiceBusAdd XML documentation comments to public methods in
SubscriptionBuilderDiagram Walkthrough
File Walkthrough
SubscriptionBuilder.cs
Fix factory invocation and add handler overload with docssrc/Core/src/Eventuous.Subscriptions/Registrations/SubscriptionBuilder.cs
AddCompositionEventHandleroverload withFunc
THandler>parameter to wrap factory in lambda(sp, _) =>getInnerHandler(sp)instead of registering factory directlyAdd new overload of
AddCompositionEventHandlerthat acceptsFuncfor wrappinghandlers with service provider access
Add comprehensive XML documentation comments to all public methods
explaining parameters and behavior
Improve code formatting and readabilityCompositionHandlerTests.cs
Add composition handler factory registration testssrc/Core/test/Eventuous.Tests.Subscriptions/CompositionHandlerTests.cs
CompositionHandlerTestswith comprehensive testcoverage for factory-based handler registration
ShouldResolveCompositionHandlerWithFactoryvalidates thathandlers are correctly resolved from DI container with factory
functions
ShouldHandleEventWithCompositionHandlervalidates end-to-endevent handling through composition wrapper
TestHandler,CompositionWrapper,TestDependency, andTestHandlerLoggerhelper classesServiceBusMessageBuilder.cs
Convert to primary constructor syntaxsrc/Azure/src/Eventuous.Azure.ServiceBus/Producers/ServiceBusMessageBuilder.cs
cleaner code
ServiceBusHelper.cs
Modernize pattern matching and add headerssrc/Azure/src/Eventuous.Azure.ServiceBus/Shared/ServiceBusHelper.cs
orpattern matching instead ofnested ternary operators
IsSerialisableByServiceBus.cs
Clean up test data formattingsrc/Azure/test/Eventuous.Tests.Azure.ServiceBus/IsSerialisableByServiceBus.cs
using System.Threading.TasksimportEsdbEventStore.cs
Add unused variable in ReadEventssrc/EventStore/src/Eventuous.EventStore/EsdbEventStore.cs
xinReadEventsmethod (appears to be incompleteor debug code)